/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package models.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import model.dao.util.MySqlDataAccessHelper;
import model.pojo.DanhMucPOJO;

/**
 *
 * @author User
 */
public class DanhMucDAO {
public static ArrayList<DanhMucPOJO> layDanhSachDanhMuc() throws SQLException {
      ArrayList<DanhMucPOJO> ds = new ArrayList<DanhMucPOJO>();
      String sql = "SELECT * FROM DANHMUC";
      MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
      helper.open();
      ResultSet rs = helper.executeQuery(sql);
      while (rs.next()) {
         DanhMucPOJO danhMuc = new DanhMucPOJO();
         danhMuc.setMaDanhMuc(rs.getString("MaDanhMuc"));
         danhMuc.setTenDanhMuc(rs.getString("TenDanhMuc"));
         ds.add(danhMuc);
      }
      helper.close();
      return ds;
   }
}
